package com.scalar.chiptrack.externalusers.actions;

import com.scalar.chiptrack.ChipTrackAction;
import com.scalar.chiptrack.commons.SessionKeys;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: Jul 1, 2004
 * Time: 10:17:49 AM
 * To change this template use Options | File Templates.
 */
public class ExternalUserLogoffAction extends ChipTrackAction {


    public ActionForward execute (ActionMapping mapping,
                                  ActionForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response)
                                  throws Exception {

        HttpSession session = request.getSession();

        HashMap info = new HashMap();
        request.setAttribute( SessionKeys.INFO_MESSAGES, info );

        String ps = ( String ) session.getAttribute ( "ps" );
        String cstKey = ( String ) session.getAttribute ( "cstKey" );

        request.setAttribute ( "ps" , ps );
        request.setAttribute ( "cstKey" , cstKey );

        info.put( "Successfully logged out", null );

        return (mapping.findForward ("success"));
    }
}